<extend name="layout/edit" />

<block name="header">
   <style type="text/css">
        .xw-form .xw-btnRow{
           text-align: left !important;
            padding-left: 180px !important;
            background: none; 
            border: none;
        }
   </style>
</block>

<block name="content">
    <div style="padding: 10px;height: 200px;">
        <control:Form id="form"/>
    </div>
</block>


<block name="js">
   <script type="text/javascript">
    var  page = (function(ns){
        
        //页面初始化
        ns.init=function(){
        	// if(__mode==1){
        	// 	form.setValue('shop_id',$.getRequest('shop_id'));
        	// }
			// if(form.getValue('shop_id') === '' && __mode != 1){
			// 	$.setRequest({mode:1});
			// }
            var data = searchs.getData()
			var params = {}
            data.forEach(function (item) {
                if( item.type == 'date' ){
                    if( params[item.field] != undefined ){
                        params[item.field] += (' - ' + item.value)
                    }else{
                        params[item.field] = item.value
                    }
                }else{
                    params[item.field] = item.value
                }
                // date
            })
            $.ajaxs('/admin/v2/key_account_chase/get', params).then(function (res) {
                console.log(res)
            })
        }
        
        //保存
        ns.save=function(){
            console.log('43543')
            var data = form.getData()
            var params = JSON.stringify(data)
            console.log(params)
            $.ajaxs('/admin/v2/key_account_chase/set', params).then(function (res) {
                console.log(res)
                $.toast(1, '保存成功')
            })
        }
        
        return ns;
    }({}));
    
    //加载当前页面需要的控件和配置
    $(function(){  page.init();  });
   </script>
</block>


